package com.example.jebaczlodzieji;

import java.math.BigDecimal;
import java.math.MathContext;

import android.app.ActionBar;
import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

public class PiecProcet extends Activity {
double kwota;
int down2 = 0 ;
	public void onBackPressed(){
		if (down2 ==0){
			Intent indu = new Intent(this,MenuActivity.class);
			startActivity(indu);
			finish();
		}else{
			System.exit(0);
		}
		Log.d("com.example.jebaczlodzieji", "klawisz Back");
	}
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_piec_procet);
        if(Build.VERSION.SDK_INT>=11){
        	ActionBar pasek = getActionBar();
        	pasek.hide();
        }
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.piec_procet, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// Handle action bar item clicks here. The action bar will
		// automatically handle clicks on the Home/Up button, so long
		// as you specify a parent activity in AndroidManifest.xml.
		int id = item.getItemId();
		if (id == R.id.action_settings) {
			return true;
		}
		return super.onOptionsItemSelected(item);
	}
	
	public void Przelicz(View view){
		EditText edycja = (EditText)findViewById(R.id.editTextChujowy);
		BigDecimal KwotaPoprawiona  =  new BigDecimal(edycja.getText().toString());
        BigDecimal BigDecPodatek = new BigDecimal("0.05");//wartosc podatku w bigdecimal     
		TextView zobacz  = (TextView)findViewById(R.id.textViewOjebany);
		TextView panstwo  = (TextView)findViewById(R.id.textViewPanstwo);
		TextView waluta = (TextView)findViewById(R.id.textViewWaluta);
		panstwo.setText(R.string.lost) ;
		zobacz.setText(KwotaPoprawiona.multiply(BigDecPodatek).toString());
		waluta.setText(R.string.waluta);
	}
	public void pobierzWartosc(View view){
		EditText edycja = (EditText)findViewById(R.id.editTextChujowy);
		kwota = Double.parseDouble(edycja.getText().toString());	
	}
}
